﻿<!doctype html>
<html>
<!-- InstanceBegin template="/Templates/template1.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>店面收银</title>
<!-- InstanceEndEditable -->
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/jquery.pager.js"></script>
<script type="text/javascript" src="../js/gbRst.js"></script>
<script type="text/javascript" src="../js/utils.js"></script>
<script type="text/javascript" src="../js/checkLogin.js"></script>
<script type="text/javascript" src="../js/find.js"></script>
<script type="text/javascript" src="../js/pagination.js"></script>
<link href="../css/style.css" type="text/css" rel="stylesheet" />
<link href="../css/Pager.css" type="text/css" rel="stylesheet" />

<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->

<!-- InstanceBeginEditable name="EditRegion3" --> 
<script type="text/javascript">
var _bussBillNo = null;
var _shopId = null
$(function(){
	
	_bussBillNo = getIdByName("no");
	_shopId = getIdByName("shopId");
	getBussBill();
	getSailBill();
})

function getBussBill(){
	var param = {'billNo':_bussBillNo,'shopId':_shopId,'paidStatus':2}
	var bussbillInfo = _findInfo("../bussBill/find/bussBillList/0/1", param)
	if(IsNotEmpty(bussbillInfo)&&bussbillInfo.state==0){
		if(bussbillInfo.result.data.length==0){
			alertErrorMessage("单据号为："+_bussBillNo+"的单子不存在")
		}else{
			$("#cardNo").val( _getStringOfJson(0, bussbillInfo, "memberCardNo"));
			$("#customerName").val(_getStringOfJson(0, bussbillInfo, "CustName"))
			$("#discount").val(_getStringOfJson(0, bussbillInfo, "mp"))
			$("#shopName").val(_getStringOfJson(0, bussbillInfo, "shopName"))
		}		
	}
}

function getSailBill(){
	var param = {'billNo':_bussBillNo}
	var SailBill = _findInfo("../saleBill/find/shopId/"+_shopId+"/paid/date/0/1", param)
	if(IsNotEmpty(SailBill)&&SailBill.state==0){
		$("#WipeZeroAmt").val(_getIntOfJson(0, SailBill, "WipeZeroAmt"))
		$("#ShouldAmt").val(_getIntOfJson(0, SailBill, "ShouldAmt"))
		$("#FactAmt").val(_getIntOfJson(0, SailBill, "FactAmt"))
		$("#FreeAmt").val(_getIntOfJson(0, SailBill, "FreeAmt"))
		$("#standNo").val(_getStringOfJson(0, SailBill, "StandNo"))
		$("#roomNo").val(_getStringOfJson(0, SailBill, "RoomNo"))
		$("#Maker").val(_getStringOfJson(0, SailBill, "Maker"))
		$("#MAKEDATE").val(_getStringOfJson(0, SailBill, "MAKEDATE"))
		$("#billNo").val(_getStringOfJson(0, SailBill, "billNo"))
		$("#memo").val(_getStringOfJson(0, SailBill, "Memo"))
		$("#status").val(_getStringOfJson(0, SailBill, "StaName"))
		var id= _getStringOfJson(0, SailBill, "ID");
		if(IsNotEmpty(id)){
			
		
			getSailBillPay(id)
			var SailBillDetil = _findInfo("../saleBill/find/shopId/"+_shopId+"/detl/"+id, null)
			if(SailBillDetil.state==0){
				loadDetil(SailBillDetil)
			}
		}
	}
}
function getSailBillPay(id){
	var SailBillDetil = _findInfo("../saleBillPay/find/shopId/"+_shopId+"/id/"+id, null)
	if(SailBillDetil.state ==0){
		$("#cashAmt").val(_getIntOfJson(0, SailBillDetil, "cashAmt"))
		$("#regAmt").val(_getIntOfJson(0, SailBillDetil, "regAmt"))
		$("#depstAmt").val(_getIntOfJson(0, SailBillDetil, "depstAmt"))
		$("#cashCoupAmt").val(_getIntOfJson(0, SailBillDetil, "cashCoupAmt"))
		$("#bnkAmt").val(_getIntOfJson(0, SailBillDetil, "bnkAmt"))
		$("#chkAmt").val(_getIntOfJson(0, SailBillDetil, "chkAmt"))
	}
}

function loadDetil(json){
	$("#goodsList tbody").empty();
	for ( var i = 0; i < json.result.data.length; i++) {
		var htm="<tr>" 
			htm+="<td>"+ _getStringOfJson(i, json, "barCode") +"</td>"
			htm+="<td>"+ _getStringOfJson(i, json, "goodsCode") +"</td>"
			htm+="<td>"+ _getStringOfJson(i, json, "goodsName") +"</td>"
			htm+="<td>"+ _getStringOfJson(i, json, "barCode") +"</td>"
			var nums = _getStringOfJson(i, json, "Nums")
			htm+="<td>"+ nums +"</td>"
			htm+="<td>"+ _getStringOfJson(i, json, "SalePrice") +"</td>"
			var zk =  _getStringOfJson(i, json, "MemDict")
			zk = IsEmpty(zk)?1:zk
			htm+="<td>"+zk+"</td>"
			var price =_getStringOfJson(i, json, "FactPrice")
			htm+="<td>"+ price +"</td>"
			
			htm+="<td>"+ parseFloat(price*nums).toFixed(2)  +"</td>"
			htm+="<td>"+ _getStringOfJson(i, json, "memo") +"</td>"
			htm+="</tr>"
				$("#goodsList tbody").append(htm);
			}
}



</script>
</head>

<body>
<div id="yinying1"></div>

<div class="container" id="container">
  <div class="container_R fr">
    <div class="place" style="width:960px;">消费详情</div>
    <div class="member_search">
     
      
      
       <div class="knowPerson">
      <p class="knowAll">
        <label> <span>店面：</span>
          <input type="text" readonly id="shopName" class="memberInfo">
        </label>
        
         <label> <span>单号：</span>
          <input type="text" readonly id="billNo" class="memberInfo">
        </label>
         <label> <span>开单时间：</span>
          <input type="text" readonly id="MAKEDATE" class="memberInfo">
        </label>
        </p>
        <p class="knowAll">
        <label> <span>台号：</span>
          <input type="text" readonly id="standNo" class="memberInfo">
        </label>
       
         <label> <span>房间/车牌号：</span>
          <input type="text" readonly id="roomNo" class="memberInfo">
        </label>
         <label> <span>开单人：</span>
          <input type="text" readonly id="Maker" class="memberInfo">
        </label>
        
        
        </p>
         <p class="knowAll">
         <label> <span>状态：</span>
          <input type="text" readonly id="status" class="memberInfo">
        </label>
      <label> <span>备注：</span>
          <input type="text" readonly id="memo" class="memberInfo">
        </label>
        </p>
      </div>
      <p>
      <div class="knowPerson">
      <p class="knowAll">
        <label> <span>会员卡号：</span>
          <input type="text" readonly id="cardNo" class="memberInfo">
        </label>
        <label> <span>会员姓名：</span>
          <input type="text" readonly id="customerName" class="memberInfo">
        </label>
       
         <label> <span>手机：</span>
          <input type="text" readonly id="discount" class="memberInfo">
        </label>
        </p>
      </div>
      <p>
      <p>
      <div class="knowPerson">
      <p class="knowAll">
        <label> <span>应收：</span>
          <input type="text" readonly id="ShouldAmt" class="memberInfo">
        </label>
        <label> <span>抹零：</span>
          <input type="text" readonly id="WipeZeroAmt" class="memberInfo">
        </label>
       
         <label> <span>免单：</span>
          <input type="text" readonly id="FreeAmt" class="memberInfo">
        </label>
        </p>
        <p class="knowAll">
         <label> <span>实收：</span>
          <input type="text" readonly id="FactAmt" class="memberInfo">
        </label>
    
         <p class="knowAll">
         <label> <span>现金付款：</span>
          <input type="text" readonly id="cashAmt" class="memberInfo">
        </label>
         <label> <span>预存付款：</span>
          <input type="text" readonly id="depstAmt" class="memberInfo">
        </label>
         <label> <span>代金券付款：</span>
          <input type="text" readonly id="cashCoupAmt" class="memberInfo">
        </label></p>
        <p  class="knowAll">
     	<label> <span>Pos付款：</span>
          <input type="text" readonly id="bnkAmt" class="memberInfo">
        </label>
        <label> <span>支票付款：</span>
          <input type="text" readonly id="chkAmt" class="memberInfo">
        </label>
         <label> <span>挂账付款：</span>
          <input type="text" readonly id="regAmt" class="memberInfo">
        </label>
        </p>
      </div>
    </div>
    
    <table id="goodsList" width="100%" class="member_list" cellpadding="0" cellspacing="1" border="0">
      <caption>
     <strong> 商品列表 </strong> <!-- <a href="javascript:void(0)" onclick="downRescouse()">导出数据</a> -->
      </caption>
      <thead>
        <tr>
          <th>商品条码</th>
          <th>商品编码</th>
          <th>商品名称</th>
          <th>规格型号</th>
          <th>数量</th>
          <th>折前单价</th>
          <th>折扣率</th>
          <th>折后单价</th>
          <th>小计</th>
          <th>备注</th>
        </tr>
      </thead>
       <tbody>
       
       </tbody> 
    </table>

  </div>
  <div class="fc"></div>
</div>
<!-- InstanceEndEditable --> 
<script type="text/javascript" src="../js/header.js"></script> 
<!-- <script type="text/javascript" src="../js/left.js"></script> 
 --><script type="text/javascript" src="../js/footer.js"></script> 
<script type="text/javascript">
addMargin($(".hideDiv"))
clearThis("absoluteTxt");
</script>
</body>
<!-- InstanceEnd -->
</html>
